<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
    <script src="//at.alicdn.com/t/c/font_3555687_mc2699q1yoc.js"></script>
    <title><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body>
    <noscript>
      <strong>
        We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
        properly without JavaScript enabled. Please enable it to continue.
      </strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
  <script type="text/javascript">
    mui.init({
      keyEventBind: {
        backbutton: true, //关闭back按键监听
      },
    })
    //首页返回键处理
    // 处理逻辑： 0.7s内，连续两次按返回键，则退出应用；
    var first = null
    mui.back = function () {
      // 首次按键， 提示 再按一次退出应用
      if (!first) {
        first = new Date().getTime() //记录第一次按下回退键的时间
        // mui.toast('再按一次退出应用')
        history.go(-1) // 回退到上一页
        setTimeout(function () {
          //0.7s 后清除
          first = null
        }, 700)
      } else {
        if (new Date().getTime() - first < 700) {
          //如果两次按下的时间小于0.7s
          plus.runtime.quit() //那么就退出app
        }
      }
    }
  </script>
</html>
